package com.mystnihon.freeremote.ui.fragment;

import android.os.Bundle;

import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.mystnihon.freeremote.R;
import com.mystnihon.freeremote.util.SettingsLauncher;

public class DefaultSettingsFragment extends SherlockFragment {
    
    private SettingsLauncher mSettingsLauncher;
    
    public static DefaultSettingsFragment newInstance() {
        DefaultSettingsFragment fragment = new DefaultSettingsFragment();
        return fragment;
    }
    
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
    	setHasOptionsMenu(true);
        super.onActivityCreated(savedInstanceState);
        mSettingsLauncher = new SettingsLauncher(getActivity());
    }
    
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.menu_settings, menu);
        super.onCreateOptionsMenu(menu, inflater);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.fr_menu_settings:
                openSettingsScreen();
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    protected void openSettingsScreen() {
        mSettingsLauncher.openSettingsScreen();
    }
}
